home *** CD-ROM | disk | FTP | other *** search
- VERSION 1.0 CLASS
- BEGIN
- MultiUse = -1 'True
- END
- Attribute VB_Name = "ObjRectangle"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
-
- Public x1 As Single
- Public y1 As Single
- Public x2 As Single
- Public y2 As Single
-
- Function ObjectType() As String
- ObjectType = "RECTANGLE"
- End Function
-
-
- ' ************************************************
- ' Compute the world coordinate bounds for the
- ' rectangle.
- ' ************************************************
- Sub Bound(xmin As Single, ymin As Single, xmax As Single, ymax As Single)
- If x1 < x2 Then
- xmin = x1
- xmax = x2
- Else
- xmin = x2
- xmax = x1
- End If
- If y1 < y2 Then
- ymin = y1
- ymax = y2
- Else
- ymin = y2
- ymax = y1
- End If
- End Sub
-
- ' ************************************************
- ' Write a rectangle to a file using Write.
- ' Begin with "RECTANGLE" to identify this object.
- ' ************************************************
- Sub FileWrite(filenum As Integer)
- Write #filenum, "RECTANGLE", x1, y1, x2, y2
- End Sub
- ' ************************************************
- ' Draw the rectangle on a Form, Printer, or
- ' PictureBox.
- ' ************************************************
- Sub Draw(canvas As Object)
- canvas.Line (x1, y1)-(x2, y2), , B
- End Sub
-
- ' ************************************************
- ' Read a rectangle from a file using Input.
- ' Assume the "RECTANGLE" label has already been read.
- ' ************************************************
- Sub FileInput(filenum As Integer)
- Input #filenum, x1, y1, x2, y2
- End Sub
-
-